const moduleName = 'user'
const root = require('../data/config.js').request.root;
let base = require('_base');

function make(apiName) {
  return (function (data, callback) {
    wx.request(base.simplateRequest({
      url: root + "/" + moduleName + "/" + apiName,
      data: data,
      success: callback.success
    }, true));
  });
}

module.exports = {
  getSession: make('getSession'),
  update: make('update'),
  detail: make('detail'),
  wxLogin: make('wxLogin'),
  updateDetail: make('updateDetail'),
  // this._request("user").updateDetail({[horoscope_id],[birthday],[sex] },{success: function({result: int})});
  sendTemplateMessage: make('sendTemplateMessage'),
  // this._request("user").sendTemplateMessage({templateDataParam},{success: function({cash: int})});
}

// let templateDataParam = {
//   "touser": wx.getStorageSync("token_session").openid,
//   "template_id": "-IifOvAFv8XzUxXVP3X2B0s7TVR-m075thsqpnjmgWk",
//   "page": "/pages/welcome/index?key=" + party_id,
//   "form_id": that.data.formIdDepot[0],
//   "data": {
//     "keyword1": {
//       "value": value['name']
//     },
//     "keyword2": {
//       "value": value['address']
//     },
//   }
// };